<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <!DOCTYPE html>
	<head>
    	<meta charset="utf-8">
    	<title>ECharts</title>
    	<!-- 在本项目中引入jquery库文件 -->
		<!--   <script type="text/javascript" src="./js/jquery-1.11.3.min.js"></script> -->
		  <!-- 联网引入jquery库文件 -->
		  <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
 	</head>
 	
 <%
 	request.setCharacterEncoding("UTF-8");
  %>
 
<body>
<%  
   //页面每隔30秒自动刷新一遍      
   /* response.setHeader("refresh","180");  */ 
%>  
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main" style="height:600px"></div>

    <!-- ECharts单文件引入  联网引入-->
    <script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
   
    <script type="text/javascript">
    	// 路径配置 require.config配置后就可以通过动态加载使用echarts
        require.config({
            paths: {
                echarts: 'http://echarts.baidu.com/build/dist'
            }
        });
  
    	//获得后台传过来的JSON数据
    	var opt =${option};
    	//设置主要样式
    	require(
	    	[
	    		// 按需加载所需图表，如需动态类型切换功能，别忘了同时加载相应图表
	    		'echarts',	
	    		'echarts/chart/bar',
	    		'echarts/chart/line',
	    		'echarts/chart/pie',
	    		'echarts/chart/map',
	    		'echarts/chart/funnel'
	    	],
	    	function(ec){ 
	    		//初始化echart对象
	    		var chart =ec.init(document.getElementById('main'),'macarons');//ec.init( $("#main"));

			   	chart.setOption(opt);
			   	
			  	 });
    </script>
      
    <style>
    	.alink{ width: 200px;}
    </style>
    
    <%!
		List<String> list = null;
		String errorReason = null;
	%>
	<%
        list=(List<String>)request.getAttribute("provinces");//获取列表
        errorReason = (String)request.getAttribute("errorReason");
    %>
 			
    <% 
    	if(list!=null){
	        for(int i=0;i < list.size();i++){
	       		 out.println("<a class='alink' href='"+basePath+"download_springmvc?province="+list.get(i)+"'>"+list.get(i)+"</a>");
	        } 
    	}
    %>

   <%
		if(errorReason!=null){
			out.println(errorReason);
		}
   %>
   <br>
  <!--  <a href="http://localhost:8080/qianlima_bidi/download_springmvc?province=白痴">不能下载的测试</a> -->
   <br>
   <a href="./echartView?path=bidi_qianlima">返回主页</a>
   <br>
</body>
</html>
